class petDog{
    public String name = "旺财";
    public String color = "黄色";

    public void barks(){
        System.out.println(name+"正在汪汪汪~~~~");
    }
    public void eat(){
        System.out.println(color+"的狗正在吃饭~~~");
    }
}
class Date{
    public int year;
    public int month;
    public int day;
    public Date(int year,int month,int day){
        System.out.println("调用带三个参数的构造方法！！！");
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public  Date(){
        this(2021,10,3);
        System.out.println("调用不带参数的构造方法！！！");
        System.out.println(this.year);
    }
    public void setDay(int year,int month,int day){
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public void printDay(){
        System.out.println("年："+this.year+"  月："+this.month+"  日："+this.day);
    }

}
public class Test {

    public static void main(String[] args) {//利用构造方法初始化成员变量
        Date d1 = new Date();
        Date d2 = new Date(2021,10,23);
        Date d3 = new Date();
        d1.printDay();

    }
    public static void main2(String[] args) {
        Date d1 = new Date();
        Date d2 = new Date();
        Date d3 = new Date();
        d1.setDay(2023,11,6);
        d2.setDay(2021,11,6);
        d3.setDay(2022,11,6);
        d1.printDay();
        d2.printDay();
        d3.printDay();
    }
    public static void main1(String[] args) {
        petDog dog = new petDog();//对象的实例化
        petDog dog2 = new petDog();
        //dog.color = "黄色";
        //dog.name = "旺财";
        dog.barks();
        dog.eat();

    }
}
